package 补充.输入输出操作.文件操作;

import java.io.*;

public class 对象流反序列化 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileInputStream fis = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read.txt");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Student1 stu = (Student1)ois.readObject();
        System.out.println(stu.getId());
        System.out.println(stu.getName());

    }
}
class Student1 implements Serializable {
    public Integer id;
    public String name;
    public Student1(Integer id, String name){
        this.id = id;
        this.name = name;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
